package com.dataseek.iot.mysql.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dataseek.iot.mysql.entity.Location;
import com.dataseek.iot.mysql.mapper.LocationMapper;
import com.dataseek.iot.mysql.service.ILocationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 坐标表 服务实现类
 * </p>
 *
 * @author cc
 * @since 2021-10-28
 */
@Service
public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements ILocationService {

    /**
     * 根据区域编码查询坐标信息
     * @param code
     * @return
     */
    public Location getLocationByCode(String code){
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("region_code", code);
        return this.getOne(wrapper);
    }
}
